package com.pan.admin.module.channel.dao;

import com.pan.admin.module.channel.entity.LoanChannelMarket;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 渠道关联产品Dao接口
 *
 * @author ts
 * @date 2023-09-18
 */
@Mapper
public interface LoanChannelMarketDao {

    /**
     * 根据ID获取列表渠道关联贷超
     *
     * @param id 渠道关联贷超主键
     * @return 渠道关联贷超
     */
    LoanChannelMarket getById(Long id);

    /**
     * 查询渠道关联贷超列表
     *
     * @param loanChannelMarket 渠道关联贷超
     * @return 渠道关联贷超集合
     */
    List<LoanChannelMarket> list(LoanChannelMarket loanChannelMarket);

    /**
     * 新增渠道关联贷超
     *
     * @param loanChannelMarket 渠道关联贷超
     * @return 结果
     */
    int insertLoanChannelMarket(LoanChannelMarket loanChannelMarket);

    /**
     * 批量新增 渠道关联贷超
     *
     * @param loanChannelMarketList
     * @return
     */
    int batchInsert(List<LoanChannelMarket> loanChannelMarketList);

    /**
     * 修改渠道关联贷超
     *
     * @param loanChannelMarket 渠道关联贷超
     * @return 结果
     */
    int updateLoanChannelMarket(LoanChannelMarket loanChannelMarket);

    /**
     *  更新所有该贷超id的开关状态
     *
     *  @param  marketId    贷超id
     *  @param  status      状态
     *  @return int
     */
    int updateAllSwitch(@Param("marketId") Long marketId, @Param("status") Integer status);

    /**
     * 删除渠道关联贷超
     *
     * @param id 渠道关联贷超主键
     * @return 结果
     */
    int deleteById(Long id);

    /**
     *  根据贷超主键id，删除所有关联该贷超主键id的渠道项
     *
     *  @param   marketId 贷超id
     *  @return int
     */
    int deleteByMarketId(@Param("marketId") Long marketId);

    /**
     * 批量删除渠道关联贷超
     *
     * @param ids 需要删除的数据主键集合
     * @return 结果
     */
    int batchDeleteById(Long[] ids);

    /**
     * 设置头排
     */
    void updateEnableTop();
}
